Management of long-running locks and transactions on database tables

ABSTRACT

An exclusive lock is acquired on each of an outer database ownership table and an inner database ownership table to obtain ownership of a database. The exclusive locks are converted to a pair of overlapping shared locks on each of the outer database ownership table and the inner database ownership table, where release and re-acquisition of each of the pair of overlapping shared locks on the outer database ownership table and the inner database ownership table permits database maintenance operations to be performed while maintaining the ownership of the database.

BACKGROUND

The present invention relates to database tables and long-running locks.More particularly, the present invention relates to management oflong-running locks and transactions on database tables.

Messaging engines (MEs) provide a runtime environment for certain webapplication servers, such as Websphere® application servers (WAS). EachME relies on a database to store runtime information along withapplication messages. Every ME maintains a set of tables to store itsruntime and persistence information within the database for recovery inthe event of disaster.

SUMMARY

A method includes attempting to establish, via at least one processor,an exclusive lock on each of an outer database ownership table and aninner database ownership table; switching, in response to establishingthe exclusive lock on each of the outer database ownership table and theinner database ownership table, to a pair of overlapping shared locks oneach of the outer database ownership table and the inner databaseownership table; and alternating release and re-acquisition of each ofthe pair of overlapping shared locks on the outer database ownershiptable and the inner database ownership table.

A system includes a memory device including an outer database ownershiptable and an inner database ownership table; and a processor programmedto attempt to establish an exclusive lock on each of the outer databaseownership table and the inner database ownership table; switch, inresponse to establishing the exclusive lock on each of the outerdatabase ownership table and the inner database ownership table, to apair of overlapping shared locks on each of the outer database ownershiptable and the inner database ownership table; and alternate release andre-acquisition of each of the pair of overlapping shared locks on theouter database ownership table and the inner database ownership table.

A computer program product includes a computer readable storage mediumincluding computer readable program code, where the computer readableprogram code when executed on a computer causes the computer to attemptto establish an exclusive lock on each of an outer database ownershiptable and an inner database ownership table; switch, in response toestablishing the exclusive lock on each of the outer database ownershiptable and the inner database ownership table, to a pair of overlappingshared locks on each of the outer database ownership table and the innerdatabase ownership table; and alternate release and re-acquisition ofeach of the pair of overlapping shared locks on the outer databaseownership table and the inner database ownership table.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an example of an implementation of a systemfor management of long-running locks and transactions on database tablesaccording to an embodiment of the present subject matter;

FIG. 2 is a block diagram of an example of an implementation of a coreprocessing module capable of performing automated management oflong-running locks and transactions on database tables according to anembodiment of the present subject matter;

FIG. 3 is a flow chart of an example of an implementation of a processfor automated management of long-running locks and transactions ondatabase tables according to an embodiment of the present subjectmatter;

FIG. 4A is a flow chart of an example of an implementation of initialprocessing within a process for automated management of long-runninglocks and transactions on database tables using a multi-threadedmessaging engine according to an embodiment of the present subjectmatter; and

FIG. 4B is a flow chart of an example of an implementation of additionalprocessing within a process for automated management of long-runninglocks and transactions on database tables using a multi-threadedmessaging engine according to an embodiment of the present subjectmatter.

DETAILED DESCRIPTION

The examples set forth below represent the necessary information toenable those skilled in the art to practice the invention and illustratethe best mode of practicing the invention. Upon reading the followingdescription in light of the accompanying drawing figures, those skilledin the art will understand the concepts of the invention and willrecognize applications of these concepts not particularly addressedherein. It should be understood that these concepts and applicationsfall within the scope of the disclosure and the accompanying claims.

The subject matter described herein provides technology for managementof long-running locks and transactions on database tables. The presentsubject matter operates within the present examples using a messagingengine (ME), though other implementations are considered within thescope of the present subject matter. Because multiple messaging engineinstances may be activated concurrently, each messaging engine performsinitial processing to attempt to acquire exclusive ownership of adatabase/data store using exclusive locks on outer and inner databaseownership tables. Once the exclusive locks are acquired by any messagingengine, that messaging engine designates itself as the owner of thedatabase, releases the exclusive locks and commits table transactions onthe respective database ownership tables, and transitions to overlappingshared locks and transactions on the inner and outer database ownershiptables. The messaging engine further transitions to multi-threadedconcurrent processing to alternate release and re-acquisition of theoverlapping shared locks and overlapping shared transactions on theouter and inner database ownership tables. This use of overlappingshared locks and overlapping transactions ensures that no othermessaging engine can take ownership of the database/data store, whileproviding intervals of time during which maintenance tools may accessthe respective database ownership tables for maintenance and/or updateof the database/data store, as well as maintenance and/or update of themessaging engines themselves including the outer and inner databaseownership tables. Accordingly, tools and batch processes running ontables (e.g., utilities such as ImageCopy, Backup, Analyzing queries,reorganization, backups, recovery, online version-to-version migration,versioning of messaging engines themselves, etc.) are not prohibitedfrom executing by long-running transactions and exclusive locks.

It should be noted that conception of the present subject matterresulted from recognition of certain limitations associated with locksand transactions on database tables by messaging engines (MEs). Forexample, it was observed that redundant ME instances (identicalentities) are utilized in messaging environments and only one is allowedto be active and access/own a data store (e.g., database) at any onetime within the messaging environment, while the other ME(s) are onstandby to prevent downtime in the event of failure of the active MEinstance. However, it was further observed that it is possible for twoapplication servers to lose contact with each other or for one tosuspect that the other is unhealthy while a messaging engine instance isstill actively performing database work. It was additionally observedthat, as a result, service integration bus (SIBus/SIB) table space andtable locks, maintained within a long-running transaction, are used toensure that there is no possibility of two instances damaging customerdata by attempting to update the messaging engine database concurrently.In was recognized that, in order to overcome this problem, MEs ofprevious systems hold “enduring locks” in the database, and that theseenduring locks cause several issues and problems in a productionenvironment. It was further observed that the problems described aboveare applicable to multiple operating systems and platforms (e.g., z/OS®,Linux®/Unix®/Windows® (LUW), etc.). It was additionally recognized thatmany systems operate within a twenty-four hour/seven days-per-week(24×7) production environment and that all maintenance andversion-to-version migration is performed online (e.g., while systemsare active). Within this context, it was determined that because theservice integration bus (SIBus/SIB) messaging engine keeps locks as longas a WebSphere® Application Server (WAS) is active (e.g., the internalDB2® (Database 2) z/OS® skeleton package table (SKPT) Lock caused by notcommitting the connection), the skeleton package table space (e.g.,SPT01 directory) database of DB2® is negatively affected. It was furtherdetermined that all operations that require an exclusive access on SPT01(e.g., reorganization, backups, recovery, online version-to-versionmigration, versioning of messaging engines themselves, etc.) cannot runwhile enduring locks are held by an ME on the database/tables and that aWAS has to be shut down for these operations, which is not possible in a24×7 production environment. It was further recognized that there areseveral applications connecting to these DB2® subsystems and thatadministrators may want to pool idle connections (e.g., connections thatare inactive) to save resources. However, it was determined that such apooling (e.g., ZPARM CMTSTAT) may only occur if the connections arecommitted periodically, which is not possible within previous systemswhile enduring locks are held by an ME on the database/tables. It wasadditionally recognized that other tools and batch processes run on alltables (e.g., utilities like ImageCopy, Backup, Analyzing queries,etc.). However, it was determined that because there is no commitoperation within previous systems due to the enduring locks held by anME on the database/tables, claims/drains are held, utilities may fail,and timeouts occur. It was further recognized that the locking problemsare multiplied in implementations where database sharing is used.

In view of the several recognitions and determinations discussed above,it was concluded that if a database table is used to serialize severalapplication server (e.g., WAS) instances, this should not be performedby locks that are held the whole life of an application server instance(e.g., messaging engine), even if this is only a shared lock, and thatperiodic commits may be used to eliminate the database maintenance andadministration problems described above. The present subject matterimproves management of long-running locks and transactions on databasetables by allowing ongoing maintenance operations, upgrades, and otherservice issues to be performed while instances of messaging engines areactive, using periodic commits of transactions on database tables totemporarily release enduring locks held by the messaging engines. Thepresent technology provides a solution of not holding a long-enduringexclusive lock on the tables, and instead alternating overlapping sharedlocks between two different tables, thus ensuring a timely commit of thetransactions is performed and that there is no one single transactionthat is open and running for a long duration. With these changes, theabove problems are addressed, and at the same time the presenttechnology ensures that no two different ME's are allowed to access thesystem tables concurrently.

For purposes of the present examples, two database ownership tables areutilized. However, it is understood that the present technology may beapplied to additional database ownership tables without departure fromthe scope of the present subject matter. The two example databaseownership tables represent an outer database ownership table and aninner database ownership table against which transactions are performedand locks are obtained to gain access to data within a database/datastore. For ease of illustration of the following examples, the outerdatabase ownership table will be referred as a service integration busowner “outer” (SIBOWNERO) table, where the suffix “O” is appended. Theinner database ownership table will be referred to as a serviceintegration bus owner (SIBOWNER) table without any suffix. However, itis understood that other naming conventions may be used withoutdeparture from the scope of the present subject matter, and the presentsubject matter may be applied to any data area for which multipleinstances of an entity are attempting to gain access to and control ofthe data area.

As detailed below, the present technology introduces overlappingtransactions alternating between the SIBOWNER and SIBOWNERO tables. Ashared lock by any messaging engine (ME) on either table will keep otherMEs from taking over the database/data store. This approach alsomaintains a low profile for service interfaces, such as SIB, since no MEwill have an excessively long-running transaction. As such, the presenttechnology allows for periods of inactivity for both database ownershiptables while an ME is active during which database tools may runnormally to perform updates, analysis, and other database maintenancetasks, as described above and in more detail below.

The management of long-running locks and transactions on database tablesdescribed herein may be performed in real time to allow promptprocessing of transactions and maintenance of database tables. Forpurposes of the present description, real time shall include any timeframe of sufficiently short duration as to provide reasonable responsetime for information processing acceptable to a user of the subjectmatter described. Additionally, the term “real time” shall include whatis commonly termed “near real time”-generally meaning any time frame ofsufficiently short duration as to provide reasonable response time foron-demand information processing acceptable to a user of the subjectmatter described (e.g., within a portion of a second or within a fewseconds). These terms, while difficult to precisely define are wellunderstood by those skilled in the art.

FIG. 1 is a block diagram of an example of an implementation of a system100 for management of long-running locks and transactions on databasetables. A client computing device_1 102 through a client computingdevice_N 104 communicate via a network 106 with one or more of aserver_1 108 through a server_M 110. Each of the server_1 108 throughthe server_M 110 execute one or more instances of an application server,such as a Websphere® application server (WAS), that may generally bereferred to herein alternatively as messaging engine (ME) instances. Ahigh-availability (HA) management server 112 manages the server_1 108through the server_M 110 to ensure that only one messaging engine (ME)of one of the application server instances obtains ownership and controlof a database 114. The client computing device device_1 102 through theclient computing device_N 104 may interact with one another and with oneor more of the server_1 108 through the server_M 110 using an MEinstance.

An outer database ownership table (SIBOWNERO table) 116 and an innerdatabase ownership table (SIBOWNER table) 118 are utilized by therespective MEs of the application server instances to obtain a data area120 of the database 114. As described above, for ease of illustrationwithin the present examples, the outer database ownership table has beenreferred to as a service integration bus owner “outer” (SIBOWNERO) table116, with the suffix “O” appended, while the inner database ownershiptable has been referred to as a service integration bus owner (SIBOWNER)table without any suffix. However, it is understood that other namingconventions may be used without departure from the scope of the presentsubject matter, and the present subject matter may be applied to anydata area for which multiple instances of an entity are attempting togain access to and control of the data area.

As will be described in more detail below in association with FIG. 2through FIG. 4B, the server_1 108 through the server_M 110 provideautomated management of long-running locks and transactions on databasetables. The automated management of long-running locks and transactionson database tables is based upon use by messaging engines (MEs) ofalternating enduring shared locks on the respective SIBOWNERO table 116and the SIBOWNER table 118, and the selective/alternating release ofthese enduring shared locks to allow intervals of time for maintenanceactivities on the database to be performed without termination of the MEinstance that currently owns the data area 120 of the database 114.

For purposes of the present example, all devices shown within FIG. 1represent computing devices. It should be noted that the respectivecomputing devices shown within FIG. 1 may be portable computing devices,either by a user's ability to move the computing devices to differentlocations, or by the computing device's association with a portableplatform, such as a plane, train, automobile, or other moving vehicle.It should also be noted that the computing devices may be any computingdevice capable of processing information as described above and in moredetail below. For example, the computing devices may include devicessuch as a personal computer (e.g., desktop, laptop, etc.) or a handhelddevice (e.g., cellular telephone, personal digital assistant (PDA),email device, music recording or playback device, etc.), or any otherdevice capable of processing information as described in more detailbelow.

The network 106 may include any form of interconnection suitable for theintended purpose, including a private or public network such as anintranet or the Internet, respectively, direct inter-moduleinterconnection, dial-up, wireless, or any other interconnectionmechanism capable of interconnecting the respective devices.

FIG. 2 is a block diagram of an example of an implementation of a coreprocessing module 200 capable of performing automated management oflong-running locks and transactions on database tables. The coreprocessing module 200 may be associated with any of the server_1 108through the server_M 110, as appropriate for a given implementation, forimplementation of the automated management of long-running locks andtransactions on database tables described herein. The core processingmodule 200 may also be associated with any of the client computingdevice device_1 102 through the client computing device_N 104, and theHA management server 112, as appropriate for a given implementation.Further, the core processing module 200 may provide different andcomplementary processing of enduring locks and transactions on databasetables in association with each implementation, as described in moredetail below.

As such, for any of the examples below, it is understood that any aspectof functionality described with respect to any one device that isdescribed in conjunction with another device (e.g., sends/sending, etc.)is to be understood to concurrently describe the functionality of theother respective device (e.g., receives/receiving, etc.).

A central processing unit (CPU) 202 provides computer instructionexecution, computation, and other capabilities within the coreprocessing module 200. A display 204 provides visual information to auser of the core processing module 200 and an input device 206 providesinput capabilities for the user.

The display 204 may include any display device, such as a cathode raytube (CRT), liquid crystal display (LCD), light emitting diode (LED),electronic ink displays, projection, touchscreen, or other displayelement or panel. The input device 206 may include a computer keyboard,a keypad, a mouse, a pen, a joystick, or any other type of input deviceby which the user may interact with and respond to information on thedisplay 204.

It should be noted that the display 204 and the input device 206 areillustrated with a dashed-line representation within FIG. 2 to indicatethat they may be optional components for the core processing module 200for certain implementations. Accordingly, the core processing module 200may operate as a completely automated embedded device without directuser configurability or feedback. However, the core processing module200 may also provide user feedback and configurability via the display204 and the input device 206, respectively.

A communication module 208 provides interconnection capabilities thatallow the core processing module 200 to communicate with other moduleswithin the system 100. The communication module 208 may include anyelectrical, protocol, and protocol conversion capabilities useable toprovide the interconnection capabilities. Though the communicationmodule 208 is illustrated as a component-level module for ease ofillustration and description purposes, it should be noted that thecommunication module 208 may include any hardware, programmedprocessor(s), and memory used to carry out the functions of thecommunication module 208 as described above and in more detail below.For example, the communication module 208 may include additionalcontroller circuitry in the form of application specific integratedcircuits (ASICs), processors, antennas, and/or discrete integratedcircuits and components for performing communication and electricalcontrol activities associated with the communication module 208.Additionally, the communication module 208 may include interrupt-level,stack-level, and application-level modules as appropriate. Furthermore,the communication module 208 may include any memory components used forstorage, execution, and data processing for performing processingactivities associated with the communication module 208. Thecommunication module 208 may also form a portion of other circuitrydescribed without departure from the scope of the present subjectmatter.

The database 114 is also shown associated with the core processingmodule 200 within FIG. 2 to show that the database 114 may be coupled tothe core processing module 200 without requiring external connectivity,such as via the network 106.

A memory 210 includes a lock and transaction information storage area212 that stores universal identifiers (UIDs), lock status, and otherinformation associated with ownership of a database table. Aconfiguration information storage area 214 stores configurationinformation for use in association with alternating enduring locks ondatabase ownership tables, such as the SIBOWNERO table 116 and theSIBOWNER table 118. The configuration information may be used to provideconfigured time delays for committing transactions on database ownershiptables and releasing shared locks on database tables, and time delaysfor re-acquisition of shared locks, as described in more detail below,and other configuration information as appropriate for a givenimplementation.

It is understood that the memory 210 may include any combination ofvolatile and non-volatile memory suitable for the intended purpose,distributed or localized as appropriate, and may include other memorysegments not illustrated within the present example for ease ofillustration purposes. For example, the memory 210 may include a codestorage area, an operating system storage area, a code execution area,and a data area without departure from the scope of the present subjectmatter.

A messaging engine 216 is illustrated in a dashed-line representation asboth an application that is stored and executed from within the memory210 by the CPU 202 and as a separate hardware component/module of thecore processing module 200. It is understood that multiple instances ofthe messaging engine 216 may be instantiated/implemented in associationwith the core processing module 200 and that each such messaging engine216 may attempt to gain ownership of the data area 120 of the database114, as described above and in more detail below.

The memory 210 also includes a maintenance application 218 that may beutilized to update the database 114 as described above. The maintenanceapplication 218 may be executed, for example, on any of the computingdevices shown and described in association with FIG. 1.

Regarding the hardware component/module implementation of the messagingengine 216, though this module is illustrated as a component-levelmodule for ease of illustration and description purposes, it should benoted that the messaging engine 216 may include any hardware, programmedprocessor(s), and memory used to carry out the functions of themessaging engine 216 as described above and in more detail below. Forexample, the messaging engine 216 may include additional controllercircuitry in the form of application specific integrated circuits(ASICs), processors, and/or discrete integrated circuits and componentsfor performing communication and electrical control activitiesassociated with the respective devices. Additionally, the messagingengine 216 may include interrupt-level, stack-level, andapplication-level modules as appropriate. Furthermore, the messagingengine 216 may include any memory components used for storage,execution, and data processing for performing processing activitiesassociated with the module.

It should also be noted that the messaging engine 216 may form a portionof other circuitry described without departure from the scope of thepresent subject matter. Further, as described above, the messagingengine 216 may alternatively be implemented as an application storedwithin the memory 210. In such an implementation, the messaging engine216 may include instructions executed by the CPU 202 for performing thefunctionality described herein. The CPU 202 may execute theseinstructions to provide the processing capabilities described above andin more detail below for the core processing module 200. The messagingengine 216 may form a portion of an interrupt service routine (ISR), aportion of an operating system, a portion of a browser application, or aportion of a separate application without departure from the scope ofthe present subject matter.

A timer/clock module 220 is illustrated and used to determine timing anddate information, such as for use in association with configured timedelays for committing transactions on database ownership tables, asdescribed above and in more detail below. As such, the messaging engine216 may utilize information derived from the timer/clock module 220 forinformation processing activities, such as the management oflong-running locks and transactions on database tables described herein.

The CPU 202, the display 204, the input device 206, the communicationmodule 208, the database 114, the memory 210, the messaging engine 216,and the timer/clock module 220 are interconnected via an interconnection222. The interconnection 222 may include a system bus, a network, or anyother interconnection capable of providing the respective componentswith suitable interconnection for the respective purpose.

While the core processing module 200 is illustrated with and has certaincomponents described, other modules and components may be associatedwith the core processing module 200 without departure from the scope ofthe present subject matter. Additionally, it should be noted that, whilethe core processing module 200 is described as a single device for easeof illustration purposes, the components within the core processingmodule 200 may be co-located or distributed and interconnected via anetwork without departure from the scope of the present subject matter.For a distributed arrangement, the display 204 and the input device 206may be located at a point of sale device, kiosk, or other location,while the CPU 202 and memory 210 may be located at a local or remoteserver. Many other possible arrangements for components of the coreprocessing module 200 are possible and all are considered within thescope of the present subject matter. It should also be understood that,though the SIB OWNERO table 116, the SIBOWNER table 118, and the dataarea 120 are shown within the database 114, they may also be storedwithin the memory 210 without departure from the scope of the presentsubject matter. Accordingly, the core processing module 200 may takemany forms and may be associated with many platforms.

FIG. 3 through FIG. 4B described below represent example processes thatmay be executed by devices, such as the core processing module 200, toperform the automated management of long-running locks and transactionson database tables associated with the present subject matter. Manyother variations on the example processes are possible and all areconsidered within the scope of the present subject matter. The exampleprocesses may be performed by modules, such as the messaging engine 216and/or executed by the CPU 202, associated with such devices. It shouldbe noted that time out procedures and other error control procedures arenot illustrated within the example processes described below for ease ofillustration purposes. However, it is understood that all suchprocedures are considered to be within the scope of the present subjectmatter. Further, the described processes may be combined, sequences ofthe processing described may be changed, and additional processing maybe added or removed without departure from the scope of the presentsubject matter.

FIG. 3 is a flow chart of an example of an implementation of a process300 for automated management of long-running locks and transactions ondatabase tables. At block 302, the process 300 attempts to establish,via at least one processor, an exclusive lock on each of an outerdatabase ownership table and an inner database ownership table. At block304, the process 300 switches, in response to establishing the exclusivelock on each of the outer database ownership table and the innerdatabase ownership table, to a pair of overlapping shared locks on eachof the outer database ownership table and the inner database ownershiptable. At block 306, the process 300 alternates release andre-acquisition of each of the pair of overlapping shared locks on theouter database ownership table and the inner database ownership table.

FIGS. 4A-4B illustrate a flow chart of an example of an implementationof a process 400 for automated management of long-running locks andtransactions on database tables using a multi-threaded messaging engine.It should be noted that the process 400 may be executed by multiplemessaging engines (MEs) and that each ME is assumed to be implemented asa multi-threaded module within the present example. However, it isunderstood that the processing described herein may be performed by asingle-threaded module without departure from the scope of the presentsubject matter.

FIG. 4A illustrates initial processing within the process 400 andillustrates an initial lock acquisition phase during which exclusivelocks on the outer and inner database ownership tables (SIBOWNERO andSIBOWNER, respectively) are acquired by a messaging engine to takeownership of the database/data store. As described in more detail below,these exclusive locks are released and converted to overlapping sharedlocks once ownership of the database/data store is obtained. It shouldbe noted that once ownership of the database/data store is obtained, theoverlapping shared locks on the database ownership tables will preventother messaging engines from taking ownership of the database/datastore. FIG. 4B illustrates a lock maintenance phase during which theoverlapping shared locks on the outer and inner database ownershiptables (SIBOWNERO and SIBOWNER, respectively) are alternately releasedand re-acquired. It should be noted that the processing during the lockmaintenance phase operates without holding long-running locks. Thisprocessing allows maintenance tools, for example and as described above,to have access to the database ownership tables and to the data storefor maintenance, versioning, and other authorized purposes, includingupdates to the messaging engines and database ownership tablesthemselves.

Within FIG. 4A, at decision point 402, the process 400 makes adetermination as to whether a request to start a messaging engine (ME)has been received, such as via a startup sequence, reboot, or otherwise.In response to determining that a request to start a messaging engine(ME) has been received, the process 400 starts a messaging engine (ME)instance at block 404.

At block 406, the process 400 attempts to acquire an exclusive lock onthe outer database ownership table, referred to as the SIBOWNERO tablefor purposes of the present example. At decision point 408, the process400 makes a determination as to whether an exclusive lock on theSIBOWNERO table was acquired. It should be noted that acquiring theshared lock on the SIBOWNERO table also starts a transaction on theSIBOWNERO table. It should also be noted that this transaction that isopened, and all other table transactions that are described as beingstarted herein, is/are different from an application transaction. Inresponse to the application requesting the lock, the database (DB)implicitly creates a transaction and it is this transaction that is keptopen until committed as described herein. In response to determiningthat an exclusive lock was not acquired, the process 400 stops themessaging engine at block 410. For example, another messaging engine mayhave already acquired the exclusive lock on the SIBOWNERO table. Atblock 412, the process 400 notifies the high availability (HA) managerthat the messaging engine was stopped and returns to decision point 402and iterates as described above.

Returning to the description of decision point 408, in response todetermining that an exclusive lock on the SIBOWNERO table was acquired,the process 400 attempts to acquire an exclusive lock on the innerdatabase ownership table at block 414, referred to as the SIBOWNER tablefor purposes of the present example. At decision point 416, the process400 makes a determination as to whether an exclusive lock on theSIBOWNER table was acquired. It should be noted that acquiring theshared lock on the SIBOWNER table also starts a transaction on the SIBOWNER table. In response to determining that an exclusive lock was notacquired, the process 400 stops the messaging engine at block 418. Forexample, another messaging engine may have already acquired the lock onthe SIBOWNER table. At block 420, the process 400 notifies the highavailability (HA) manager that the messaging engine was stopped andreturns to decision point 402 and iterates as described above.

Returning to the description of decision point 416, in response todetermining that an exclusive lock on the SIBOWNER table was acquired,the process 400 updates the SIBOWNER table with the messaging engineuniversal/unique identifier (UID) information to indicate that thecurrent messaging engine is the active messaging engine instance atblock 422. It should be noted that acquiring the shared lock on theSIBOWNER table also starts a transaction on the SIBOWNER table. As such,and as described in more detail below, during the lock maintenance phasedescribed in association with FIG. 4B, when a shared lock on the innerdatabase ownership table (SIBOWNER) is released, a maintenance tool orother authorized process may view the messaging engine UID within theinner database ownership table to determine which messaging engine isthe active messaging engine instance.

At block 424, the process 400 commits the transaction on the innerdatabase ownership table (SIBOWNER). At block 426, the process 400releases the exclusive lock on the SIBOWNER table and acquires a sharedlock on the SIBOWNER table. Acquiring the shared lock on the SIBOWNERtable also starts a transaction on the SIBOWNER table. At block 428, theprocess 400 commits the transaction on the outer database ownershiptable (SIBOWNERO). At block 430, the process 400 releases exclusive lockon the SIBOWNERO table and acquires a shared lock on the SIBOWNEROtable. Acquiring the shared lock on the SIBOWNERO table also starts atransaction on the SIBOWNERO table.

Processing within the process 400 transitions to multi-threadedprocessing within the present example in response to acquiring theshared lock on the SIB OWNER table at block 426 as represented by thecircled reference (A) and in response to acquiring the shared lock onthe SIBOWNERO table at block 430 as represented by the circled reference(B). The process 400 transitions to the processing shown and describedin association with FIG. 4B and performs multi-threaded processing ofthe overlapping shared locks on the inner and outer database ownershiptables to alternate release and re-acquisition of each of theoverlapping shared locks on the outer database ownership table and theinner database ownership table.

FIG. 4B illustrates additional processing associated with the process400 for automated management of long-running locks and transactions ondatabase tables using a multi-threaded messaging engine. As describedabove, FIG. 4B illustrates multi-threaded processing that initiates atthe circled reference (A) and circled reference (B). For ease ofdescription purposes, these threads will be referred to as “Thread_A”and “Thread_B,” respectively, relative to the respective circledreferences. Each of these multi-threaded processes alternates releaseand re-acquisition of one of the overlapping shared locks on therespective database ownership tables. Thread_A operates to release andre-acquire the overlapping shared lock on the inner database ownershiptable (SIBOWNER), while Thread_B operates to release and re-acquire theoverlapping shared lock on the outer database ownership table(SIBOWNERO).

Beginning with a description within FIG. 4B of Thread_A processingwithin the process 400 for alternating release and re-acquisition of theoverlapping shared lock on the SIBOWNER table at the circled reference(A), the Thread_A of the process 400 gets a configured time delay forcommitting the SIBOWNER table, such as from the configurationinformation storage area 214 within the memory 210, at block 432. Itshould be noted that this time delay may be configured as a single timedelay usable both for waiting to determine when ownership of theSIBOWNERO table is acquired by the other thread (e.g., Thread_B) and forwaiting to re-acquire a shared lock on the SIBOWNER table by the currentthread (e.g., Thread_A). However, this time delay may also be configuredas two separate time delays, with a first time delay referred to withinthe present examples as a “shared lock release time delay” for waitingto determine when ownership of the SIBOWNERO table is acquired by theother thread (e.g., Thread_B) and a second time delay referred to withinthe present examples as a “shared lock re-acquisition time delay” forwaiting to determine when to re-acquire the shared lock on the SIBOWNERtable within the current thread (Thread_A).

For purposes of the present description, it should be noted that theprocess 400 operating within the current thread (Thread_A) has alreadyacquired a shared lock on the SIBOWNER table, as described above inassociation with FIG. 4A. At decision point 434, the Thread_A of theprocess 400 makes a determination as to whether a shared lock is alsoheld on the outer database ownership table (SIBOWNERO) by the otherthread (e.g., Thread_B). In response to determining that a shared lockis not currently held on the SIBOWNERO table by the other thread (e.g.,Thread_B), the Thread_A of the process 400 sets the configurable sharedlock release time delay associated with acquisition of a lock on theSIBOWNERO table by the other thread (e.g., Thread_B) at block 436. Thistime delay ensures that the shared locks on both database ownershiptables are overlapping prior to release of the shared lock on theSIBOWNER table by the current thread (e.g., Thread_A). This time delayalso ensures that the respective transactions on the two databaseownership tables are also overlapping prior to committing eithertransaction. To avoid crowding within the drawing figure, processing todetermine when the configured shared lock release time delay has expiredis not shown. However, it is understood to form a part of the processingwithin the Thread_A of the process 400.

In response to expiration of the configured shared lock release timedelay, the Thread_A of the process 400 returns to decision point 434. Inresponse to determining at decision point 434 that the shared lock isalso held on the SIB OWNERO table by the other thread (e.g., Thread_B),the Thread_A of the process 400 commits the transaction on the innerdatabase ownership table (SIB OWNER) at block 438. Two actions areperformed responsive to commitment of the transaction on the SIBOWNERtable by the Thread_A of the process 400. The first action performed bythe Thread_A is to notify the Thread_B that is holding the SIBOWNEROtable to take over the transaction at block 440. This action issymbolically represented within FIG. 4B by a transition represented bythe circled (C), though this should not be considered limiting as thenotification may be synchronous or asynchronous, and may occur withrespect to any stage of processing within the Thread_B of the process400. The second action performed by Thread_A is to release the sharedlock on the SIBOWNER table at block 442.

The Thread_A of the process 400 sets the configured shared lockre-acquisition time delay for the SIBOWNER table at block 444. To avoidcrowding within the drawing figure, processing to determine when theconfigured shared lock re-acquisition time delay has expired is notshown. However, it is understood to form a part of the processing withinthe Thread_A of the process 400. In response to expiration of theconfigured shared lock re-acquisition time delay, the Thread_A of theprocess 400 re-acquires the shared lock on the SIBOWNER table at block446, and iterates back to block 432 to continue iterative processing toalternate the release and re-acquisition of the overlapping shared locksand transactions on the inner database ownership table as describedabove. Re-acquiring the shared lock on the SIB OWNER table also starts anew transaction on the SIB OWNER table. As such, the Thread_A of theprocess 400 alternates release and re-acquisition of the overlappingshared locks on the inner database ownership table (SIBOWNER), andalternates transactions and release of transactions on the innerdatabase ownership table (SIB OWNER).

Regarding the Thread_B of the process 400 beginning at the circled (B)within FIG. 4B, the Thread_B performs processing for alternating releaseand re-acquisition of the overlapping shared lock on the outer databaseownership table (SIB OWNERO). The Thread_B of the process 400 gets aconfigured time delay for committing the SIBOWNERO table, such as fromthe configuration information storage area 214 within the memory 210, atblock 448. It should be noted that this time delay may be configured asa single time delay usable both for waiting to determine when ownershipof the inner database should table (SIBOWNER) is acquired by the otherthread (e.g., Thread_A) and for waiting to re-acquire a shared lock onthe SIBOWNERO table by the current thread (e.g., Thread_B). However,this time delay may also be configured as two separate time delays, witha first time delay referred to within the present examples as a “sharedlock release time delay” for waiting to determine when ownership of theSIB OWNER table is acquired by the other thread (e.g., Thread_A) and asecond time delay referred to within the present examples as a “sharedlock re-acquisition time delay” for waiting to determine when tore-acquire the shared lock on the SIB OWNERO table within the currentthread (Thread_B).

For purposes of the present description, it should be noted that theprocess 400 operating within the current thread (Thread_B) has alreadyacquired a shared lock on the outer database ownership table(SIBOWNERO), as described above in association with FIG. 4A. At decisionpoint 450, the Thread_B of the process 400 makes a determination as towhether a shared lock is also held on the SIB OWNER table by the otherthread (e.g., Thread_A). In response to determining that a shared lockis not currently held on the SIBOWNER table by the other thread (e.g.,Thread_A), the Thread_B of the process 400 sets the configurable sharedlock release time delay associated with acquisition of a lock on theSIBOWNER table by the other thread (e.g., Thread_A) at block 452. Thistime delay ensures that the shared locks on both database ownershiptables are overlapping prior to release of the shared lock on the outerdatabase ownership table (SIB OWNERO) by the current thread (e.g.,Thread_B). This time delay also ensures that the respective transactionson the two database ownership tables are also overlapping prior tocommitting either transaction. To avoid crowding within the drawingfigure, processing to determine when the configured shared lock releasetime delay has expired is not shown. However, it is understood to form apart of the processing within the Thread_B of the process 400.

In response to expiration of the configured shared lock release timedelay, the Thread_B of the process 400 returns to decision point 450. Inresponse to determining at decision point 450 that the shared lock isalso held on the SIBOWNER table by the other thread (e.g., Thread_A),the Thread_B of the process 400 commits the transaction on the SIBOWNEROtable at block 454. Two actions are performed responsive to commitmentof the transaction on the SIBOWNERO table by the Thread_B of the process400. The first action performed by the Thread_B is to notify theThread_A that is holding the SIBOWNER table to take over the transactionat block 456. This action is symbolically represented within FIG. 4B byan arrow to the input of block 446 within the Thread_A processing,though this should not be considered limiting as the notification may besynchronous or asynchronous, and may occur with respect to any stage ofprocessing within the Thread_A of the process 400. The second actionperformed by Thread_B is to release the shared lock on the SIB OWNEROtable at block 458.

The Thread_B of the process 400 sets the configured shared lockre-acquisition time delay for the SIBOWNERO table at block 460. To avoidcrowding within the drawing figure, processing to determine when theconfigured shared lock re-acquisition time delay has expired is notshown. However, it is understood to form a part of the processing withinthe Thread_B of the process 400. In response to expiration of theconfigured shared lock re-acquisition time delay, the Thread_B of theprocess 400 re-acquires the shared lock on the SIBOWNERO table at block462, and iterates back to block 448 to continue iterative processing toalternate release and re-acquisition of the overlapping shared locks andtransactions on the outer database ownership table as described above.Re-acquiring the shared lock on the SIBOWNERO table also starts a newtransaction on the SIBOWNERO table. As such, the Thread_B of the process400 alternates release and re-acquisition of the overlapping sharedlocks on the outer database ownership table (SIBOWNERO), and alternatestransactions and release of transactions on the outer database ownershiptable (SIB OWNERO).

As such, the process 400 performs initial processing to acquireexclusive ownership of the database/data store using exclusive locks onthe outer and inner database ownership tables. The process 400 thenreleases the exclusive locks, commits the respective table transactions,and transitions to overlapping shared locks and transactions on theinner and outer database ownership tables. The process 400 transitionsto multi-threaded processing to alternate release and re-acquisition ofoverlapping shared locks and overlapping shared transactions on theouter and inner database ownership tables. This use of overlappingshared locks and overlapping transactions ensures that no othermessaging engine can take ownership of the database/data store, whileallowing intervals of time for maintenance and/or update of thedatabase/data store and the messaging engines themselves including theouter and inner database ownership tables. Accordingly, tools and batchprocesses running on tables (e.g., utilities such as ImageCopy, Backup,Analyzing queries, etc.) are not prohibited from executing bylong-running transactions and exclusive locks.

As described above in association with FIG. 1 through FIG. 4B, theexample systems and processes provide technology for management oflong-running locks and transactions on database tables. Many othervariations and additional activities associated with management oflong-running locks and transactions on database tables are possible andall are considered within the scope of the present subject matter.

Those skilled in the art will recognize, upon consideration of the aboveteachings, that certain of the above examples are based upon use of aprogrammed processor, such as the CPU 202. However, the invention is notlimited to such example embodiments, since other embodiments could beimplemented using hardware component equivalents such as special purposehardware and/or dedicated processors. Similarly, general purposecomputers, microprocessor based computers, micro-controllers, opticalcomputers, analog computers, dedicated processors, application specificcircuits and/or dedicated hard wired logic may be used to constructalternative equivalent embodiments.

As will be appreciated by one skilled in the art, aspects of the presentinvention may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present invention may take the formof an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, micro-code, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present invention may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), a portablecompact disc read-only memory (CD-ROM), an optical storage device, amagnetic storage device, or any suitable combination of the foregoing.In the context of this document, a computer readable storage medium maybe any tangible medium that can contain, or store a program for use byor in connection with an instruction execution system, apparatus, ordevice.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electro-magnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent invention may be written in any combination of one or moreprogramming languages, including an object oriented programming languagesuch as Smalltalk, C++ or the like and conventional proceduralprogramming languages, such as the “C” programming language or similarprogramming languages. The program code may execute entirely on theuser's computer, partly on the user's computer, as a stand-alonesoftware package, partly on the user's computer and partly on a remotecomputer or entirely on the remote computer or server. In the latterscenario, the remote computer may be connected to the user's computerthrough any type of network, including a local area network (LAN) or awide area network (WAN), or the connection may be made to an externalcomputer (for example, through the Internet using an Internet ServiceProvider).

Aspects of the present invention have been described with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in acomputer-readable storage medium that can direct a computer or otherprogrammable data processing apparatus to function in a particularmanner, such that the instructions stored in the computer-readablestorage medium produce an article of manufacture including instructionswhich implement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

A data processing system suitable for storing and/or executing programcode will include at least one processor coupled directly or indirectlyto memory elements through a system bus. The memory elements can includelocal memory employed during actual execution of the program code, bulkstorage, and cache memories which provide temporary storage of at leastsome program code in order to reduce the number of times code must beretrieved from bulk storage during execution.

Input/output or I/O devices (including but not limited to keyboards,displays, pointing devices, etc.) can be coupled to the system eitherdirectly or through intervening I/O controllers.

Network adapters may also be coupled to the system to enable the dataprocessing system to become coupled to other data processing systems orremote printers or storage devices through intervening private or publicnetworks. Modems, cable modems and Ethernet cards are just a few of thecurrently available types of network adapters.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a,” “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, elements,components, and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below are intended toinclude any structure, material, or act for performing the function incombination with other claimed elements as specifically claimed. Thedescription of the present invention has been presented for purposes ofillustration and description, but is not intended to be exhaustive orlimited to the invention in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the artwithout departing from the scope and spirit of the invention. Theembodiment was chosen and described in order to best explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

What is claimed is:
 1. A method, comprising: by a messaging engineprocessor that executes a messaging engine: acquiring, to obtainownership of a database, a first exclusive lock on an outer databaseownership table that provides a first access control to the database anda second exclusive lock on an inner database ownership table thatprovides a second access control to the database; converting the firstexclusive lock to a first shared lock on the outer database ownershiptable and the second exclusive lock to a second shared lock on the innerdatabase ownership table, where alternating release and re-acquisitionof each of the first and second shared locks on the outer databaseownership table and the inner database ownership table permits databasemaintenance operations to be performed while maintaining the ownershipof the database; and providing at least one period of inactivity of boththe outer database ownership table and the inner database ownershiptable that allows at least one database tool to execute to perform atleast one database maintenance task during the execution of themessaging engine.
 2. The method of claim 1, where converting the firstexclusive lock to the first shared lock on the outer database ownershiptable and the second exclusive lock to the second shared lock on theinner database ownership table comprises the messaging engine processor:releasing each of the first exclusive lock on the outer databaseownership table and the second exclusive lock on the inner databaseownership table; acquiring the respective first and second shared lockson the outer database ownership table and the inner database ownershiptable; committing an exclusive lock transaction on each of the outerdatabase ownership table and the inner database ownership table; andstarting processing of overlapping shared lock transactions on each ofthe outer database ownership table and the inner database ownershiptable.
 3. The method of claim 1, further comprising the messaging engineprocessor alternating the release and re-acquisition of each of thefirst and second shared locks on the outer database ownership table andthe inner database ownership table by alternating commitment andre-start of overlapping shared lock transactions on each of the outerdatabase ownership table and the inner database ownership table.
 4. Themethod of claim 1, further comprising the messaging engine processorperforming the alternating release and re-acquisition of each of thefirst and second shared locks within separate concurrent threads of themessaging engine.
 5. The method of claim 1, where the databasemaintenance operations comprise maintenance of any of the database, theinner database ownership table, or the outer database ownership table.6. A system, comprising: a memory device comprising an outer databaseownership table and an inner database ownership table; and a messagingengine processor that executes a messaging engine, where the messagingengine processor is programmed to: acquire, to obtain ownership of adatabase, a first exclusive lock on the outer database ownership tablethat provides a first access control to the database and a secondexclusive lock on the inner database ownership table that provides asecond access control to the database; convert the first exclusive lockto a first shared lock on the outer database ownership table and thesecond exclusive lock to a second shared lock on the inner databaseownership table, where alternating release and re-acquisition of each ofthe first and second shared locks on the outer database ownership tableand the inner database ownership table permits database maintenanceoperations to be performed while maintaining the ownership of thedatabase; and provide at least one period of inactivity of both theouter database ownership table and the inner database ownership tablethat allows at least one database tool to execute to perform at leastone database maintenance task during the execution of the messagingengine.
 7. The system of claim 6, where, in being programmed to convertthe first exclusive lock to the first shared lock on the outer databaseownership table and the second exclusive lock to the second shared lockon the inner database ownership table, the messaging engine processor isprogrammed to: release each of the first exclusive lock on the outerdatabase ownership table and the second exclusive lock on the innerdatabase ownership table; acquire the respective first and second sharedlocks on the outer database ownership table and the inner databaseownership table; commit an exclusive lock transaction on each of theouter database ownership table and the inner database ownership table;and start processing of overlapping shared lock transactions on each ofthe outer database ownership table and the inner database ownershiptable.
 8. The system of claim 6, where the messaging engine processor isfurther programmed to alternate the release and re-acquisition of eachof the first and second shared locks on the outer database ownershiptable and the inner database ownership table by being programmed toalternate commitment and re-start of overlapping shared locktransactions on each of the outer database ownership table and the innerdatabase ownership table.
 9. The system of claim 6, where the messagingengine processor is further programmed to perform the alternatingrelease and re-acquisition of each of the first and second shared lockswithin separate concurrent threads of the messaging engine.
 10. Thesystem of claim 6, where the database maintenance operations comprisemaintenance of any of the database, the inner database ownership table,or the outer database ownership table.
 11. A computer program productcomprising a computer readable storage medium including computerreadable program code, where the computer readable storage medium is nota transitory signal per se and where the computer readable program codewhen executed on a computer implemented as a messaging engine causes thecomputer to: acquire, to obtain ownership of a database, a firstexclusive lock on an outer database ownership table that provides afirst access control to the database and a second exclusive lock on aninner database ownership table that provides a second access control tothe database; convert the first exclusive lock to a first shared lock onthe outer database ownership table and the second exclusive lock to asecond shared lock on the inner database ownership table, wherealternating release and re-acquisition of each of the first and secondshared locks on the outer database ownership table and the innerdatabase ownership table permits database maintenance operations to beperformed while maintaining the ownership of the database; and provideat least one period of inactivity of both the outer database ownershiptable and the inner database ownership table that allows at least onedatabase tool to execute to perform at least one database maintenancetask during the execution of the messaging engine.
 12. The computerprogram product of claim 11, where, in causing the computer to convertthe first exclusive lock to the first shared lock on the outer databaseownership table and the second exclusive lock to the second shared lockon the inner database ownership table, the computer readable programcode when executed on the computer causes the computer to: release eachof the first exclusive lock on the outer database ownership table andthe second exclusive lock on the inner database ownership table; acquirethe respective first and second shared locks on the outer databaseownership table and the inner database ownership table; commit anexclusive lock transaction on each of the outer database ownership tableand the inner database ownership table; and start processing ofoverlapping shared lock transactions on each of the outer databaseownership table and the inner database ownership table.
 13. The computerprogram product of claim 11, where the computer readable program codewhen executed on the computer further causes the computer to alternatethe release and re-acquisition of each of the first and second sharedlocks on the outer database ownership table and the inner databaseownership table by causing the computer to alternate commitment andre-start of overlapping shared lock transactions on each of the outerdatabase ownership table and the inner database ownership table.
 14. Thecomputer program product of claim 11, where the computer readableprogram code when executed on the computer further causes the computerto perform the alternating release and re-acquisition of each of thefirst and second shared locks within separate concurrent threads of themessaging engine.
 15. The computer program product of claim 11, wherethe database maintenance operations comprise maintenance of any of thedatabase, the inner database ownership table, or the outer databaseownership table.